import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
df=pd.read_excel('最新发布的北京二手房数据_预处理.xlsx')
plt.rcParams['font.sans-serif']='Simhei'
plt.figure(figsize=(12,6))
df_count=df.groupby('所在区').size()
ax1=plt.subplot(1,1,1)
x=df_count.first_valid_index
height=df_count
ax1.bar(x,height,width=0.6,color=(0.894,0,0.498))
ax1.set_ylabel('房源数量')
ax1.legend(('数量',),loc='upper left')
plt.title('各区二手数量和均价')